package com.itheima.mapper;

import com.itheima.domain.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @Author 王加鑫
 * @Date 2021/08/18 21:18
 * @Since JDK 1.8
 */
@Mapper
public interface StudentMapper {

    @Select("select * from student")
    List<Student> findAll();

    @Select("select * from student where number = #{number}")
    Student findStudentById(String number);

    @Insert("insert into student values(#{number},#{name},#{birthday},#{address})")
    int save(Student student);

    @Update("update student set name = #{name},birthday = #{birthday},address = #{address} where number = #{number}")
    int update(Student student);

    @Delete("delete from student where number = #{number}")
    int delete(String number);
}
